package cn.wolfcode.crm.service.impl;


import cn.wolfcode.crm.domain.Audit;
import cn.wolfcode.crm.mapper.AuditMapper;
import cn.wolfcode.crm.query.StagingQueryObject;
import cn.wolfcode.crm.service.IAuditService;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class AuditServiceImpl implements IAuditService {

    @Autowired
    AuditMapper auditMapper;

    public PageResult query(StagingQueryObject qo) {
        int count = auditMapper.query4Count(qo);
        if (count > 0) {
            return new PageResult(count, auditMapper.query4List(qo));
        }
        return new PageResult(count, Collections.EMPTY_LIST);
    }

    public int deleteByPrimaryKey(Long id) {return auditMapper.deleteByPrimaryKey(id);
    }

    public int insert(Audit record) {

        return auditMapper.insert(record);
    }

    public Audit selectByPrimaryKey(Long id) {
        return auditMapper.selectByPrimaryKey(id);
    }

    public List<Audit> selectAll() {
        return auditMapper.selectAll();
    }

    public int updateByPrimaryKey(Audit record) {
        return auditMapper.updateByPrimaryKey(record);
    }
}
